package com.chenu.gamscriptman.controller;

import com.chenu.gamscriptman.compoent.Global;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import springfox.documentation.annotations.ApiIgnore;

/**
 * @author flyan
 * date 2020-02-16
 * @function 文档控制器，它用于处理文档任务完成需要视图的服务后返回的回复消息
 */
@Controller
@ApiIgnore
public class DocumentController {

    private Logger logger = LoggerFactory.getLogger(this.getClass());

    @Autowired
    private RedisTemplate jsonRedisTemplate;

    /**
     * 列出文档内容
     */
    @GetMapping("/docs")
    public String users(
            Model model
    ){
        /* 放入文档内容 */
        String fileContent = (String) jsonRedisTemplate.opsForValue().get(Global.REDIS_DOCUMENT_CONTENT);
        model.addAttribute(Global.REDIS_DOCUMENT_CONTENT, fileContent);

        return "doc/docs";
    }

}
